package controleur;
import javax.swing.event.*;

import vue.*;
/**
 * 
 * @author Plancq Charlotte, Lanvin Kévin, Darras Raphael
 *
 *
 */
public class ListeCollectionListener implements ListSelectionListener,ListDataListener {
	PanelCollections p;

	public ListeCollectionListener(PanelCollections p) {
		this.p=p;
	}

	public void valueChanged(ListSelectionEvent arg0) {
		if(! p.getList().isSelectionEmpty()){
			p.getAG().clearRecherche();
			p.getAG().setCentre(new AffichageCollection(p.getAG()));
		}
	}

	@Override
	public void contentsChanged(ListDataEvent arg0) {
		// TODO Auto-generated method stub
		p.update();
	}

	@Override
	public void intervalAdded(ListDataEvent arg0) {
		// TODO Auto-generated method stub
		p.update();
	}

	@Override
	public void intervalRemoved(ListDataEvent arg0) {
		// TODO Auto-generated method stub
		p.update();
	}

}
